def mySqrt (n):
=0
old=n/2
newwhile abs(old-new)>1e-10 :
=new
old=1/2*(old+n/old)
newreturn new
4 Functions
4.0.0.1 Sqrt 사용자 정의 함수 실습
3) mySqrt(
1.7320508075688772
=[1,2,3,4,5,6,7,8]
list_int=["1","2","3","4","5","6","7","8"] list_str
list(filter(lambda x:x,list_str))
['1', '2', '3', '4', '5', '6', '7', '8']
list(filter(lambda x:x+"1",list_str))
['1', '2', '3', '4', '5', '6', '7', '8']
bool("2")
True
list(filter(lambda x:x,list_int))
[]
list(filter(lambda x:bool(x-1),list_x))
[2, 3, 4]
filter(lambda x:x-1,list_int)
<filter at 0x1f5d235af10>